<template>
  <!-- 轮播图的高一般在： 500px ~ 600px -->
  <el-carousel
    :interval="2000"
    arrow
    height="150px"
    width="100%"
    indicator-position
    ref="carousel"
    trigger
    
  >
    <el-carousel-item
      v-for="(img, index) in imgList"
      :key="index"
      @click.native="goSolution(index)"
    >
      <img :src="img.url" width="100%" height="100%" />
    </el-carousel-item>
  </el-carousel>
</template>

<script>
export default {
  data() {
    return {
      imgList: [
        {
          url: require("../assets/wallhaven-4xw81o.jpg"),
        },
        {
          url: require("../assets/logo.png"),
        },
        {
          url: require("../assets/wallhaven-4xw81o.jpg"),
        },
        {
          url: require("../assets/logo.png"),
        },
      ],
    };
  },
  methods: {
    goSolution(index) {
      console.log(index);
      this.$router.push("/article");
    },
  },
};
</script>



<style>
.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}
.el-carousel{
  /* height: 55rem */
}
.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>